package util

import (
	"crypto/md5"
	"encoding/hex"
	"fmt"
	"platon-tools/go-service/common/constant"
	"time"
)

// 生成session_key
func GenerateSessionKey(userId interface{}) string {
	key := MD5(ToString(userId) + time.Now().Format(constant.DATE_MINUTE_FORMAT))
	fmt.Println(key)
	return key
}

func MD5(param string) string {
	h := md5.New()
	h.Write([]byte(param))
	return hex.EncodeToString(h.Sum(nil))
}
